<?php
namespace app\index\controller;
use app\index\model\Allproblems_model;
use think\Controller;
use think\Session;
use think\Db;

//所有问题控制器
class Allproblems extends Common
{



    // 总数
    public function total()
    {
        $project_id = '';
        $params = input();
        $params['problem_type']  = isset($params['problem_type'])?$params['problem_type']:'';
        $params['problem_title'] = isset($params['problem_title'])?$params['problem_title']:'';
        $model = new Allproblems_model;
        $sele_sql = $model->select($params);
        $this->assign('sele_sql',$sele_sql);
        $this->assign('params',$params);
        return view('bu_total');
    }




    //详情页
    public function total_details()
    {
        $params = input();
        $params['logs_operator']  = isset($params['logs_operator'])?$params['logs_operator']:'';
        $params['logs_operation_behavior'] = isset($params['logs_operation_behavior'])?$params['logs_operation_behavior']:'';
        $Goods = new Allproblems_model;
        $sele_sql = $Goods->details($params);
        $logs = $Goods->logs($params);
        $assignee = $Goods->assignee();
        $deng = $Goods->deng();
        $this->assign('sele_sql',$sele_sql);
        $this->assign('logs',$logs);
        $this->assign('assignee',$assignee);
        $this->assign('deng',$deng);
        return view('bu_total_details');
    }





    //日志删除
    public function delete()
    {
        $params = input();
        $delete = new Allproblems_model;
        $sql = $delete->del($params);
        $this->success();
        return $this->redirect("allproblems/total_details?problem_id=".$params['problem_id']);
    }





     //完成
    public function cparamsy_out()
    {
        $params = input();
        $Goods = new Allproblems_model;
        $sele_sql = $Goods->cparamsy_out($params);
        $sele_sql = $Goods->details($params);
        $this->assign('sele_sql',$sele_sql);
        // return view('bu_total_details');
        return $this->redirect("allproblems/total_details?problem_id=".$params['problem_id']);
    }





    //拒绝
    public function rejected()
    {
        $params = input();
        $Goods = new Allproblems_model;
        $sele_sql = $Goods->rejected($params);
        $sele_sql = $Goods->details($params);
        $this->assign('sele_sql',$sele_sql);
        // return view('bu_total_details');
        return $this->redirect("allproblems/total_details?problem_id=".$params['problem_id']);
    }






    //关闭 按钮
    public function closed()
    {
        $params = input();
        $Goods = new Allproblems_model;
        $sele_sql = $Goods->closed($params);
        $sele_sql = $Goods->details($params);
        $this->assign('sele_sql',$sele_sql);
        // return view('bu_total_details');
        return $this->redirect("allproblems/total_details?problem_id=".$params['problem_id']);
    }





     //关闭   左侧边菜单 
    public function menu_closed()
    {
        $params = input();
        $Goods = new Allproblems_model;
        $menu_closed = $Goods->menu_closed($params);
        $this->assign('menu_closed',$menu_closed);
        return view('bu_closed');
    }





    //延期
    public function extension()
    {
        $params = input();

        $Goods = new Allproblems_model;
        $sele_sql = $Goods->extension($params);
        $sele_sql = $Goods->details($params);
        $this->assign('sele_sql',$sele_sql);
        // return view('bu_total_details');
        return $this->redirect("allproblems/total_details?problem_id=".$params['problem_id']);
    }




    //延期  左侧边菜单
    public function menu_postponep()
    {
        $params = input();
        $Goods = new Allproblems_model;
        $menu_extension = $Goods->menu_extension($params);
        $this->assign('menu_extension',$menu_extension);
        return view('bu_postponep');
    }





    //未解决
    public function unsolved()
    {
        $params = input();
        $Goods = new Allproblems_model;
        $sele_sql = $Goods->unsolved($params);
        $sele_sql = $Goods->details($params);
        $this->assign('sele_sql',$sele_sql);
        // return view('bu_total_details');
        return $this->redirect("allproblems/total_details?problem_id=".$params['problem_id']);
    }
    




    //已解决  任务按钮
    public function solved()
    {
        $params = input();
        $Goods = new Allproblems_model;
        $sele_sql = $Goods->solved($params);
        $sele_sql = $Goods->details($params);
        $this->assign('sele_sql',$sele_sql);
        // return view('bu_total_details');
        return $this->redirect("allproblems/total_details?problem_id=".$params['problem_id']);
    }






    //已解决  左侧边菜单
    public function menu_solved()
    {
        $params = input();
        $Goods = new Allproblems_model;
        $menu_solved = $Goods->menu_solved($params);
        $this->assign('menu_solved',$menu_solved);
        return view('bu_solved');
        // $this->success('ok'); 
    }



    //不通过审核
    public function fail()
    {
        $params = input();
        $Goods = new Allproblems_model;
        $sele_sql = $Goods->fail($params);
        $sele_sql = $Goods->details($params);
        $this->assign('sele_sql',$sele_sql);
        // return view('bu_total_details');
        return $this->redirect("allproblems/total_details?problem_id=".$params['problem_id']);
    }





    //通过审核
    public function by()
    {
        $params = input();
        $Goods = new Allproblems_model;
        $sele_sql = $Goods->by($params);
        $sele_sql = $Goods->details($params);
        $this->assign('sele_sql',$sele_sql);
        // return view('bu_total_details');
        // echo "<script> alert('ok');location.href='allproblems/total_details?problem_id='".$params['problem_id'].";</script>";
       return $this->redirect("allproblems/total_details?problem_id=".$params['problem_id']);
    }





    //接受任务
    public function accept_mission()
    {
        $params = input();
        $Goods = new Allproblems_model;
        $sele_sql = $Goods->accept_mission($params);
        $sele_sql = $Goods->details($params);
        $this->assign('sele_sql',$sele_sql);
        return $this->redirect("allproblems/total_details?problem_id=".$params['problem_id']); 
    }





    //已分配测试员
    public function problem_tester()
    {
        $params = input();
        $Goods = new Allproblems_model;
        $sele_sql = $Goods->problem_tester($params);
        $sele_sql = $Goods->details($params);
        $this->assign('sele_sql',$sele_sql);
        return $this->redirect("allproblems/total_details?problem_id=".$params['problem_id']);
    }
}
